# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-pyzmq
_pkgname=pyzmq
pkgver=25.1.2
pkgrel=1
pkgdesc="Python bindings for ZeroMQ"
url="https://pypi.org/project/pyzmq"
arch="all"
license="LGPL-3.0-or-later AND BSD-3-Clause"
depends="python3 py3-tornado"
makedepends="python3-dev py3-setuptools zeromq-dev"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces=py-zmq # Backwards compatibility
provides=py-zmq=$pkgver-r$pkgrel # Backwards compatibility

build() {
	python3 setup.py build
}

check() {
	python3 setup.py build_ext --inplace
	# TestAsyncioAuthentication hangs
	# TestPubLog random failures on ppc64le/s390x/aarch64
	# https://github.com/zeromq/pyzmq/issues/1853
	pytest -v \
		--deselect zmq/tests/test_log.py::TestPubLog::test_blank_root_topic \
		--deselect zmq/tests/test_log.py::TestPubLog::test_custom_debug_formatter \
		--deselect zmq/tests/test_log.py::TestPubLog::test_custom_global_formatter \
		--deselect zmq/tests/test_log.py::TestPubLog::test_init_iface \
		--deselect zmq/tests/test_log.py::TestPubLog::test_init_socket \
		--deselect zmq/tests/test_log.py::TestPubLog::test_root_topic \
		--deselect zmq/tests/test_log.py::TestPubLog::test_set_info_formatter_via_property \
		--deselect zmq/tests/test_log.py::TestPubLog::test_unicode_message \
		--deselect zmq/tests/asyncio/test_asyncio.py::TestAsyncioAuthentication::test_blacklist \
		--deselect zmq/tests/asyncio/test_asyncio.py::TestAsyncioAuthentication::test_curve \
		--deselect zmq/tests/asyncio/test_asyncio.py::TestAsyncioAuthentication::test_plain \
		--deselect zmq/tests/test_context.py::TestContext::test_mockable \
		--deselect zmq/tests/test_cython.py::test_cython[3] \
		--deselect zmq/tests/test_cython.py::test_cython[2] \
		--deselect zmq/tests/test_zmqstream.py::test_callable_check \
		--deselect zmq/tests/test_zmqstream.py::test_on_recv_basic \
		--deselect zmq/tests/test_zmqstream.py::test_on_recv_wake \
		--deselect zmq/tests/test_zmqstream.py::test_on_recv_async \
		--deselect zmq/tests/test_zmqstream.py::test_on_recv_async_error
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
e2f9fec2cf65ee2cb4416a4d3562617d1fa202e2a446d51fa31e85c6b842e385fc32e3682a68119ff678a9ebd22c3e41fff37ab01d8efa9d4cb1f680a0f87e67  pyzmq-25.1.2.tar.gz
"
